Cocktail Help Reference
TryGetObject Method
See Also  Send Feedback
Cocktail Assembly > Cocktail Namespace > ObjectManager<TKey,T> Class : TryGetObject Method



key
The key used to look up the instance.

Glossary Item Box

Retrieves an object instance by key without creating a new instance if it doesn't exist.

Syntax

Visual Basic (Declaration) 
Public Function TryGetObject( _
   ByVal key As TKey _
) As T
Visual Basic (Usage)Copy Code
Dim instance As ObjectManager(Of TKey,T)
Dim key As TKey
Dim value As T
 
value = instance.TryGetObject(key)
C# 
public T TryGetObject( 
   TKey key
)
C++/CLI 
public:
T^ TryGetObject( 
   TKey^ key
) 

Parameters

key
The key used to look up the instance.

Return Value

Null if no object for the given key exists.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.